<template>
	<view>
		<view class="state">
			<view :class="state==0?'s-title':'title'" @click="tab(0)">全部</view>
			<view :class="state==1?'s-title':'title'" @click="tab(1)">待查看</view>
			<view :class="state==2?'s-title':'title'" @click="tab(2)">已查看</view>
			<view :class="state==3?'s-title':'title'" @click="tab(3)">感兴趣</view>
			<view :class="state==4?'s-title':'title'" @click="tab(4)">不合适</view>
		</view>
		<view class="lc-list" v-for="(item,index) in list" @click="detail(item.work_id)">
			<view class="lc-box">
				<view class="lc-title">{{item.title}}</view>
				<view class="lc-money">{{item.price_text}}</view>
			</view>
			<view class="lc-name">{{item.shopname}}</view>
			<view class="lc-detail">
				<view class="lc-laber">
					<view v-for="(name,num) in item.label_arr">{{name}}</view>
				</view>
				<view class="lc-address">{{item.city}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				app: getApp().globalData,
				state: 0,
				list: [],
				page: 1
			}
		},
		onShow() {
			this.page = 1
			this.list = []
			this.getList()
		},
		methods: {
			getList() {
				this.app.post('/api/wanlshop/user/workorderlist', {
					page: this.page,
					status: this.state
				}).then(res => {
					console.log(res)
					this.list = this.list.concat(res.list.data)
				})
			},
			tab(state) {
				this.state = state
				this.page = 1
				this.list = []
				this.getList()
			},
			detail(id) {
				uni.navigateTo({
					url: '/pages/lc/positionDetail/positionDetail?type=2&id=' + id
				})
			}
		},
		onReachBottom() {
			this.page += 1;
			this.getList();
		},
	}
</script>

<style lang="scss">
	.state {
		width: 750rpx;
		display: flex;
		justify-content: space-around;
		background-color: #FFFFFF;

		.s-title {
			// width: 120rpx; 
			line-height: 80rpx;
			border-bottom: 3px solid #84BD00;
			color: #84BD00;
			text-align: center;
			display: inline-block;
			margin-left: 20rpx;
			margin-right: 20rpx;
			font-size: 30rpx;
		}

		.title {
			// width: 120rpx;
			line-height: 80rpx;
			border-bottom: 2px solid #fff;
			display: inline-block;
			text-align: center;
			margin-left: 20rpx;
			margin-right: 20rpx;
			font-size: 30rpx;
		}
	}

	.lc-list {
		width: 690rpx;
		margin-top: 30rpx;
		margin-left: 30rpx;
		background-color: #FFFFFF;
		padding: 30rpx 0;
		border-radius: 16rpx;

		.lc-box {
			width: 630rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			margin-left: 30rpx;

			.lc-title {
				font-size: 33rpx;
				color: #3D3D3D;
			}

			.lc-money {
				font-size: 33rpx;
				color: #84BD00;
				font-weight: bold;
			}
		}

		.lc-name {
			width: 630rpx;
			margin-left: 30rpx;
			font-size: 30rpx;
			color: #999999;
			margin-top: 14rpx;
		}

		.lc-detail {
			width: 630rpx;
			margin-left: 30rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;
			margin-top: 30rpx;

			.lc-laber {
				display: flex;

				view {
					font-size: 24rpx;
					color: #999999;
					padding: 0 16rpx;
					line-height: 40rpx;
					background-color: #F6F6F6;
					margin-right: 10rpx;
				}

			}

			.lc-address {
				font-size: 24rpx;
				color: #999999;
			}
		}
	}
</style>